package com.huawei.appmarket.service.store.awk.card;

import android.content.Context;
import android.content.Intent;
import android.text.SpannableString;
import android.view.View;
import com.huawei.appgallery.assistantdock.base.externalaction.openviewaction.OpenViewActionRegistry;
import com.huawei.appgallery.foundation.account.bean.UserSession;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appmarket.service.pay.purchase.ProductPurchaseAction;
import com.huawei.appmarket.service.pay.purchase.ProductPurchaseAction.a;
import com.huawei.fastengine.fastview.startFastappEngine.bean.RpkInfo;
import com.huawei.gamebox.plugin.gameservice.view.TransferActivity;
import huawei.widget.HwButton;
import java.lang.ref.WeakReference;
import java.util.LinkedHashMap;
import o.bfs;
import o.AccountBussinessListener;
import o.ccp;
import o.chm;
import o.chy;
import o.dgh;
import o.dof;
import o.ContentManager;
import o.ehw;
import o.eoj;
import o.evx;
import o.ewm.n;
import o.fam;

public class BuoyProductListCard extends ProductListCard {

    static class b implements AccountBussinessListener {
        private b() {
        }

        public void onAccountBusinessResult(ccp o_ccp) {
            eoj.ˋ().ˊ("BuoyProductListCard");
        }
    }

    static class c implements a {
        private WeakReference<BuoyProductListCard> ॱ;

        public c(BuoyProductListCard buoyProductListCard) {
            this.ॱ = new WeakReference(buoyProductListCard);
        }

        public void ˎ() {
            HwButton ˋ = ˋ();
            ehw ॱ = ॱ();
            if (ˋ != null && ॱ != null && ॱ.ॱꜟ() == 1) {
                ॱ(ˋ, ॱ);
            }
        }

        public void ˏ(int i) {
            ehw ॱ = ॱ();
            if (ॱ != null) {
                ॱ.ʽ(i);
            }
        }

        public void ˏ() {
            HwButton ˋ = ˋ();
            if (ˋ != null) {
                ˋ.setText(ContentManager.getInstant().getContext().getResources().getString(n.ʼᶥ));
                ˋ.setEnabled(false);
            }
        }

        public void ˊ() {
            HwButton ˋ = ˋ();
            ehw ॱ = ॱ();
            if (ˋ != null && ॱ != null) {
                ॱ(ˋ, ॱ);
            }
        }

        private void ॱ(HwButton hwButton, ehw o_ehw) {
            o_ehw.ˏॱ(2);
            hwButton.setEnabled(false);
            hwButton.setText(ContentManager.getInstant().getContext().getResources().getString(n.ʼꜞ));
        }

        private HwButton ˋ() {
            BuoyProductListCard buoyProductListCard = (BuoyProductListCard) this.ॱ.get();
            if (buoyProductListCard == null) {
                return null;
            }
            return buoyProductListCard.ˋ();
        }

        private ehw ॱ() {
            BuoyProductListCard buoyProductListCard = (BuoyProductListCard) this.ॱ.get();
            if (buoyProductListCard == null) {
                return null;
            }
            CardBean ˌ = buoyProductListCard.ˌ();
            return ˌ instanceof ehw ? (ehw) ˌ : null;
        }
    }

    static {
        OpenViewActionRegistry.register(ProductPurchaseAction.ACTION, ProductPurchaseAction.class);
    }

    public BuoyProductListCard(Context context) {
        super(context);
    }

    private HwButton ˋ() {
        return this.ʼ;
    }

    public void ॱ(chy o_chy) {
        this.ʼ.setOnClickListener(new evx(this) {
            final /* synthetic */ BuoyProductListCard ˏ;

            {
                this.ˏ = r1;
            }

            public void ˋ(View view) {
                if (UserSession.getInstance().isLoginSuccessful()) {
                    ProductPurchaseAction.registerCallback(new c(this.ˏ));
                    Intent intent = new Intent(this.ˏ.ʼॱ, TransferActivity.class);
                    intent.setAction(ProductPurchaseAction.ACTION);
                    intent.putExtra(ProductPurchaseAction.KEY_PRODUCT_BEAN, this.ˏ.ͺ);
                    fam.ॱ().ˎ(this.ˏ.ʼॱ, TransferActivity.class, intent, true);
                    return;
                }
                this.ˏ.ˎ();
                eoj.ˋ().ˎ("BuoyProductListCard", new b());
                bfs.ˋ().ॱ(this.ˏ.ʼॱ);
            }
        });
    }

    protected void ˋ(String str, String str2) {
        if (dof.ˋ(str2)) {
            this.ʻ.setVisibility(8);
            return;
        }
        this.ʻ.setVisibility(0);
        CharSequence spannableString = new SpannableString(str2);
        spannableString.setSpan(chm.ॱ, 0, spannableString.length(), 33);
        this.ʻ.setText(spannableString);
    }

    protected void ˎ(String str, String str2) {
        if (dof.ˋ(str2)) {
            this.ʼ.setVisibility(8);
            return;
        }
        this.ʼ.setVisibility(0);
        this.ʼ.setText(str2);
    }

    protected void ˎ(View view) {
    }

    private void ˎ() {
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        linkedHashMap.put(RpkInfo.APPID, this.ͺ.ͺˏ());
        linkedHashMap.put("type", String.valueOf(11));
        linkedHashMap.put("service_type", String.valueOf(4));
        linkedHashMap.put("detailid", this.ͺ.ॱॱ());
        dgh.ˋ("card_installbtn_click", linkedHashMap);
    }
}
